<template>


  <div>

    <div style="height: 100px;margin-top: 0px ">
      <div style="float: left;width: 70%;height: 100%">
        <p style="color: black;font-size: 23px;line-height: 23px;font-weight: bold;height: 40px;margin-left: 40%">--  组队工作室管理  --</p>
      </div>
      <div style="float: left;width: 30%;height: 100%">
        <!--<el-button  v-if="this.states===0" type="success" style="margin-bottom: 20px" round @click="jumpp()">发起项目申请</el-button>-->
        <el-button  v-if="this.states===0" type="success" style="margin-bottom: 20px" round @click="jump()">添加工作室需求</el-button>
        <el-button  v-if="this.states===2" type="success" style="margin-bottom: 20px" round @click="jumpp()">查看项目安排</el-button>
      </div>
    </div>

    <div >
      <div v-for="table in teamData" style="float: left;margin-left: 85px;height: 500px;width: 360px ;background-color: white;margin-top: 50px;box-shadow: 0 8px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)" >
          <div v-if="table.puanduan===0">
              <div  style="width: 300px;height: 200px;margin-top: 40px">
                <img :src="table.photo" style="width: 250px;height: 200px;margin-left: 40px">
              </div>
              <div style="height: 30px;width: 370px;line-height: 0px">
                <div  class="text-wrapper" style="height: 30px;width: 360px">
                  <p style="line-height: 30px">招标中</p>
                </div>
              </div>
              <div class="text-wrapper" style="width: 340px;height:120px;white-space: pre-wrap;margin-top: 30px;margin-left: 10px" >
                <div style="height: 30px;line-height: 0px ">
                  <p style="width: 340px;word-wrap: break-word;height: 80px;line-height: 30px ;margin-top: 30px;overflow: auto">简介： {{table.demand}}  <a :href=table.doc >点我下载详细信息</a></p>
                  <el-row style="margin-left: 0px">
                    <el-button type="primary" size="small " round  @click="jumppp(table.id)">申请管理</el-button>
                  </el-row>
                </div>
              </div>
         </div>
          <div v-if="table.puanduan===1">


              <div  style="width: 300px;height: 200px;margin-top: 40px">
                <img :src="table.photo" style="width: 250px;height: 200px;margin-left: 40px">
              </div>
              <div style="height: 60px;width: 370px;line-height: 0px">
                <div  class="text-wrapper" style="height: 60px;width: 360px">
                  <p style="line-height: 10px">招标结束</p>
                  <p style="line-height: 30px">中标工作室名：{{table.workroomName}}</p>
                  <p style="line-height: 10px">报价：{{table.price}}</p>
                </div>
              </div>
              <div class="text-wrapper" style="width: 340px;height:120px;white-space: pre-wrap;margin-top: 30px;margin-left: 10px" >
              <div style="height: 30px;line-height: 0px ">
                <p style="width: 340px;word-wrap: break-word;height: 80px;line-height: 30px ;margin-top: 30px;overflow: auto">要求： {{table.demand}}  <a :href=table.doc >点我下载详细信息</a></p>
                <el-row style="margin-left: 0px">
                  <el-button type="primary" size="small " round  @click="jumppppp(table.id)">任务提交管理</el-button>
                  <el-button type="primary" size="small " round  @click="jumpppp(table.id)">任务管理</el-button>
                </el-row>
              </div>
            </div>

          </div>
      </div>
    </div>
  </div>


</template>

<script>
  export default {
    data() {
      return {
        states:'',
        tid:'',
        teamData:[
          {
          id:'',
          price:'',
          demand:'',
          doc:'',
          photo:'',
          workroomName:'',
          puanduan:'',
          }
        ]
      }
    },
    mounted: function(){
      // /workroom/insertWorkroomProgress

      this.states=this.$route.query.mallCode2
      this.tid = this.$route.query.mallCode
      var user= JSON.parse(window.sessionStorage.getItem("user"));
      var ff=user.id
      axios.post('/user/selectTeamDemand',{
            tid:this.tid,
            wid:this.tid
      }).then((response) => {
        if( response.data != null){
          ///workroom/insertTeamDemand
          var e=response.data


          console.log(eee)
          var data=[];

          for(var c=0;c<e.length;c++){
            var ee=e[c]
            var eee=ee.teamDemand
            var eeee=ee.workRoom

            var obj={}

            obj.id=eee.id
            obj.price=eee.price
            obj.demand=eee.demand
            obj.doc=eee.doc

            if(eee.wid!=0){
              obj.photo=eeee.photoUrl
              obj.workroomName=eeee.workroomName
              obj.puanduan=1
            }else{
              obj.photo=eee.photo
              obj.puanduan=0
            }
            data[c]=obj
            console.log(obj)}

          this.teamData=data

        }
        else{
          // this.$notify({
          //   title: '失败',
          //   message: '错误',
          //   type: 'warning',
          //   duration:2000
          // });
        }
      })

    },
    methods: {

      // jump(path){
      //   this.$router.replace({path:path})
      // },

      jumppp(path) {
        console.log(path)
        this.$router.push({
          path: '/TeamApplyManage',
          query: {
            mallCode: path,
          }
        })


      },
      jumpppp(path) {
        console.log(path)
        this.$router.push({
          path: '/WorkroomEchart',
          query: {
            mallCode: path,
            mallCode2:2
          }
        })


      },
      jumpp(){




        axios.post('/user/selectOrderByTid',{
          tid:this.tid,
          id:this.tid
        }).then((response) => {
          if( response.data != null){
            var e=response.data
            console.log(e)

            var ee=e.id

            this.$router.push({
              path: '/Echart',
              query: {
                mallCode: ee,
              }
            })


          }
          else{

          }
        })








      },
      jump(path) {
        console.log(path)
        this.$router.push({
          path: '/TeamMemberDemand',
          query: {
            mallCode: this.tid,
          }
        })


      },

      jumppppp(path) {
        console.log(path)
        this.$router.push({
          path: '/WProjectSubmit',
          query: {
            mallCode: path,

          }
        })


      },



    }}
</script>



<style scoped>

</style>
